package com.wtwd.wtwddevice.service.impl;

import com.wtwd.device.constant.SportTypeEnum;
import com.wtwd.device.util.DateUtils;
import com.wtwd.wtwddevice.service.ISportDataService;
import org.springframework.stereotype.Service;

@Service
public class SportDataServiceImpl implements ISportDataService {


    @Override
    public boolean sportDateHandle(String type, String[] split) {
        boolean flag;
        switch (SportTypeEnum.getSportTypeEnum(type)) {
            case FREE_TRAINING:
                flag = freeTrainingHandler(type, split);
                break;
            case RUN:
                flag = runHandler(type, split);
                break;
            case JUMP_ROPE:
                flag = jumpRopeHandler(type, split);
                break;
            case SIT_UPS:
                flag = sitUpsHandler(type, split);
                break;
            case BRISK_WALKING:
                flag = briskWalkingHandler(type, split);
                break;
            case RIDING:
                flag = ridingHandler(type, split);
                break;
            default:
                flag = false;
        }
        return flag;
    }

    /**
     * 自由训练#日期#时长#卡路里#平均心率#最低心率#最高心率#心率记录
     *
     * @param type
     * @param data
     * @return
     */
    @Override
    public boolean freeTrainingHandler(String type, String[] data) {
        long time = DateUtils.stringToTimestamp(data[1], DateUtils.dateFormat15);
        Integer duration = Integer.valueOf(data[2]);
        String calorie =data[3];
        String meanHeartRate=data[4];
        String minHeartRate=data[5];
        String maxHeartRate=data[6];
        String heartRate=data[7];


        return false;
    }

    @Override
    public boolean runHandler(String type, String[] data) {
        return false;
    }

    @Override
    public boolean jumpRopeHandler(String type, String[] data) {
        return false;
    }

    @Override
    public boolean sitUpsHandler(String type, String[] data) {
        return false;
    }

    @Override
    public boolean briskWalkingHandler(String type, String[] data) {
        return false;
    }

    @Override
    public boolean ridingHandler(String type, String[] data) {
        return false;
    }


}
